TablesWriteToUnit Subroutine

private subroutine TablesWriteToUnit(tables, iunit, id)

write a collection of tables on file already open. If id is present, only the table corresponding to that id is written. Arguments: tables collection of tables to be exported iunit unit to whom write the table

Arguments

Type IntentOptional Attributes Name
type(TableCollection), intent(in) :: tables
integer(kind=short), intent(in) :: iunit
character(len=*), intent(in), optional :: id

Variables

Type Visibility Attributes Name Initial
integer(kind=long), public :: i

Source Code

SUBROUTINE TablesWriteToUnit &
( tables, iunit, id )

IMPLICIT NONE

! Function arguments
! Scalar arguments with intent(in):
INTEGER (KIND = short),  INTENT (IN) :: iunit
CHARACTER (LEN = *),  OPTIONAL, INTENT (IN) :: id

! Type defined arguments with intent (in):
TYPE (TableCollection), INTENT (IN) :: tables


!Local variables:
INTEGER (KIND = long)  :: i

!------------end of declaration------------------------------------------------

IF ( PRESENT (id) ) THEN
  CALL TableWriteToUnit (  tables % elem ( TableSyncById (tables, id) ), iunit ) 
ELSE
  DO i = 1, tables % number
    CALL TableWriteToUnit (  tables % elem (i), iunit )
    WRITE(iunit,*)
  END DO
END IF

END SUBROUTINE TablesWriteToUnit